Array.prototype.myShift = function() {
    if (this.length === 0) {
        return undefined;
    }
    var first = this[0];
    for (var i = 1; i < this.length; i++) {
        this[i - 1] = this[i];
    }
    this.length = this.length - 1;
    return first;
}

// var arr = [1, 2, 3, 4];
// var res = arr.myShift();
// console.log(arr);
// console.log(res);